package jupitermouse.site.example.scala.batch

import org.apache.flink.api.scala.ExecutionEnvironment
import org.apache.flink.api.scala._
import org.apache.flink.core.fs.FileSystem.WriteMode

object SinkApp {
  def main(args: Array[String]): Unit = {
    val env = ExecutionEnvironment.getExecutionEnvironment
    val data = 1 to 10

    val text = env.fromCollection(data)
    val filePath = "file:///E:\\workroom\\learn\\flink\\demo_flink\\doc\\3"

    //设置并行度写到文件夹下，并行度1则写入文件
    text.writeAsText(filePath, WriteMode.OVERWRITE).setParallelism(2)

    env.execute("SinkApp")
  }
}
